/*********************************************************************************
CREATED BY: SCOTT FIELDER 
CREATED DATE: 4/18/2011


REVISION HISTORY:
-

***********************************************************************************/






public with sharing class FB_Me {

	public string doFBMe(string accessToken){
		
		FB_Graph_Settings__c fb = FB_Graph_Settings__c.getInstance();
		string endpoint = 	fb.Graph_Endpoint__c+'me?access_token='+accessToken;
		return endpoint;
	}
	
	 
	
		
	
	/***********************************************************
	* 						TEST METHODS
	***********************************************************/
	
	static testMethod void test_doFBMe(){
		
		test.startTest();
		
		
		FB_Graph_Settings__c fb = FB_Graph_Settings__c.getInstance();
		
		if(fb == null) {
            fb = new FB_Graph_Settings__c(SetupOwnerId = UserInfo.getOrganizationId());
        }
        
        fb.OF__API_Key__c = '111111111111111111111';
        fb.OF__App_Secret__c = '1111111111111111';
        fb.OF__Development_Mode__c = true;
        fb.OF__FB_App_Id__c = '111111111111111111';
        fb.OF__FB_Permissions_Requested__c = 'email,read_stream,publish_stream,offline_access,user_birthday';
        fb.OF__Graph_Endpoint__c = 'https://graph.facebook.com/';
        fb.OF__Host_Header__c = 'graph.facebook.com';
        
        Database.upsert(fb);
		
		 
		string accessToken = '12345';
		FB_Me cls = new FB_Me();
		string endpoint = cls.doFBMe(accessToken);
		test.stopTest();
		
		system.assert(endpoint.contains(accessToken));
		
	}
	

}